package com.hqyj.springBoot.modules.common.controller;

import com.hqyj.springBoot.modules.common.entity.ExceptionLog;
import com.hqyj.springBoot.modules.common.service.ExceptionLogService;
import com.hqyj.springBoot.modules.common.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api")
public class ExceptionLogController {

    @Autowired
    private ExceptionLogService exceptionLogService;

    /**
     * 127.0.0.1/api/exceptionLog ---post
     * {"ip":"127.0.0.1","path":"/api/city","className":"cityController","methodName":"getCityById",
     * "exceptionType":"NullPointException","exceptionMessage":"******"}
     */
    @PostMapping(value = "/exceptionLog",consumes = MediaType.APPLICATION_JSON_VALUE)
    public Result<ExceptionLog> insertExceptionLog(@RequestBody ExceptionLog exceptionLog){
        return exceptionLogService.insertExceptionLog(exceptionLog);
    }
}
